package com.cqyc.imview

import android.os.Bundle
import com.tencent.imsdk.v2.V2TIMConversation
import com.tencent.qcloud.tuicore.TUIConstants
import com.tencent.qcloud.tuicore.TUICore
import com.tencent.qcloud.tuikit.tuichat.model.GoodsModel

class TUIStartUtils {
    companion object {
        fun startC2CChatActivity(
            userId: String,
            name: String,
            faceUrl: String,
            goodsModel: GoodsModel?
        ) {
            val param = Bundle()
            param.putInt(TUIConstants.TUIChat.CHAT_TYPE, V2TIMConversation.V2TIM_C2C)
            param.putString(TUIConstants.TUIChat.CHAT_ID, TUICallKitUtils.getOtherTUIUserId(userId))
            param.putString(TUIConstants.TUIChat.CHAT_NAME, name)
            param.putBoolean(TUIConstants.TUIChat.IS_TOP_CHAT, false)
            param.putString(TUIConstants.TUIChat.FACE_URL, faceUrl)
            if (goodsModel != null) {
                param.putSerializable(GoodsModel.TAG, goodsModel)
            }
            TUICore.startActivity(TUIConstants.TUIChat.C2C_CHAT_ACTIVITY_NAME, param)
        }

        //买家端使用
        fun startConversation(){
            val param = Bundle()
            TUICore.startActivity("ConversationActivity", param)
        }
    }
}